<caltech-header title="Quote">
    <h3>CALIBRATION QUOTE</h3>
    <h5 class="visible-print"><span>Quote No. {{model.quoteNumber}}</span> - <span>Date: {{model.createdDate | date: 'dd/MMM/yyyy'}}</span></h5>
</caltech-header>

<div class="page-quote-item">
    <div class="row">
        <div class="col-xs-7">
            <div class="row">
                <div class="col-xs-3">
                    <label>Customer:</label>
                </div>
                <div class="col-xs-9">
                    <a href="#" class="editable-wrap" e-typeahead="customer as customer.name for customer in getCustomerList($viewValue)" e-typeahead-editable="false"
                       onaftersave="updateCustomer($data)" editable-text="model.company.name" buttons="no" blur="submit"><strong>{{model.company.name}}</strong></a>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-3">
                    <label>Address:</label>
                </div>
                <div class="col-xs-9">
                    <!--<span editable-text="model.company.address" buttons="no" blur="submit">{{model.company.address}}</span>-->
                    <span class="form-control-static">{{model.company.address}}</span>
                </div>
            </div>
        </div>
        <div class="col-xs-5">
            <div class="row hidden-print">
                <div class="col-xs-3" ng-show="model.quoteNumber">
                    <label>KLC Quote #:</label>
                </div>
                <div class="col-xs-9" ng-show="model.quoteNumber"><strong class="form-control-static">{{model.quoteNumber}}</strong></div>
            </div>
            <div class="row hidden-print">
                <div class="col-xs-3">
                    <label>Quote date:</label>
                </div>
                <div class="col-xs-9">
                    <a href="#" e-datepicker-popup="dd/MMM/yyyy" e-class="form-control" editable-bsdate="model.quoteDate" buttons="no" blur="submit">{{model.quoteDate | date: 'dd/MMM/yyyy'}}</a>
                </div>
            </div>
            <div class="row visible-print">
                <div class="col-xs-12">
                    <strong>KIM LONG SURVEY JSC (KLC)</strong>
                    <div><small>86 Xuan Thuy St, Thao Dien Ward, Dist. 2, HCM City, VN</small></div>
                    <div>
                        <small>Tel: +84 (8) 6281.8479 - Fax: +84 (8) 6281.8481</small>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-7">
            <div class="row">
                <div class="col-xs-3">
                    <label>Contact:</label>
                </div>
                <div class="col-xs-9">
                    <span class="form-control-static">{{model.company.contactPersonName}}</span>
                </div>
            </div>
        </div>
        <div class="col-xs-5">
            <div class="row">
                <div class="col-xs-3">
                    <label>Sales man:</label>
                </div>
                <div class="col-xs-9">
                    <span class="form-control-static">{{model.salesman.fullName}}</span>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-7">
            <div class="row">
                <div class="col-xs-3">
                    <label>Phone:</label>
                </div>
                <div class="col-xs-9">
                    <span class="form-control-static">{{model.company.tel}}</span>
                </div>
            </div>
        </div>
        <div class="col-xs-5">
            <div class="row">
                <div class="col-xs-3">
                    <label>Phone:</label>
                </div>
                <div class="col-xs-9">
                    <span class="form-control-static">{{model.salesman.tel}}</span>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-7">
            <div class="row">
                <div class="col-xs-3">
                    <label>Mobile:</label>
                </div>
                <div class="col-xs-9">
                    <span class="form-control-static">{{model.company.mobile}}</span>
                </div>
            </div>
        </div>
        <div class="col-xs-5">
            <div class="row">
                <div class="col-xs-3">
                    <label>Mobile:</label>
                </div>
                <div class="col-xs-9">
                    <span class="form-control-static">{{model.salesman.mobile}}</span>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-7">
            <div class="row">
                <div class="col-xs-3">
                    <label>Email:</label>
                </div>
                <div class="col-xs-9">
                    <span class="form-control-static">{{model.company.email}}</span>
                </div>
            </div>
        </div>
        <div class="col-xs-5">
            <div class="row">
                <div class="col-xs-3">
                    <label>Email:</label>
                </div>
                <div class="col-xs-9">
                    <span class="form-control-static">{{model.salesman.email}}</span>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/ng-template" id="customTemplate.html">
    <a style="width: 500px; display: block;">
        <div class="row">
            <div class="col-xs-6">{{match.model.modelNumber}}</div>
            <div class="col-xs-6">{{match.model.manufacturer}}</div>
        </div>
    </a>
</script>

<table class="table">
    <thead>
        <tr>
            <th class="col-xs-2">Description</th>
            <th class="col-xs-2">Model</th>
            <th class="col-xs-2">Manufacturer</th>
            <th class="col-xs-1">Service at</th>
            <th class="col-xs-1 text-center quantity">Qty</th>
            <th class="col-xs-1 text-right col-min-print">Unit Price</th>
            <th class="col-xs-1 text-right">Amount</th>
            <th class="col-xs-1 hidden-print"></th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat="item in model.items">
            <td><span class="form-control-static">{{item.name}}</span></td>
            <td>
                <span ng-disabled="!model.company.id" e-typeahead-editable="false" e-typeahead-on-select="updateQuoteItem($item, item)" e-typeahead="equipment as equipment.modelNumber for equipment in getEquipmentList($viewValue)"
                      editable-text="item.modelNumber" e-name="modelNumber" e-form="rowform" e-required class="form-control-static" typeahead-template-url="customTemplate.html">
                    {{item.modelNumberName}}
                </span>
            </td>
            <td><span class="form-control-static">{{item.manufacturer}}</span></td>
            <td>
                <span editable-select="item.servicePlace" e-name="servicePlace" e-form="rowform" e-ng-options="s.value as s.text for s in servicePlaces" e-required class="form-control-static">
                    {{showServicePlaces(item.servicePlace)}}
                </span>
            </td>
            <td>
                <span editable-number="item.quantity" e-name="quantity" e-form="rowform" e-min="1" e-required class="text-center form-control-static" e-class="text-center">
                    {{item.quantity | number}}
                </span>
            </td>
            <td>
                <span editable-number="item.unitPrice" e-name="unitPrice" e-form="rowform" e-min="0" e-required class="text-right form-control-static" e-class="text-right">
                    {{item.unitPrice | number}}
                </span>
            </td>
            <td>
                <span class="form-control-static text-right">{{(item.unitPrice * item.quantity) | number}}</span>
            </td>
            <td class="hidden-print text-right">
                <form editable-form name="rowform" ng-show="rowform.$visible" class="form-buttons form-inline">
                    <button type="submit" ng-disabled="rowform.$waiting || rowform.$invalid" class="btn btn-primary btn-sm"><b class="glyphicon glyphicon-ok"></b></button>
                    <button type="button" ng-disabled="rowform.$waiting" ng-click="rowform.$cancel()" class="btn btn-default btn-sm"><b class="glyphicon glyphicon-remove"></b></button>
                </form>
                <button ng-show="!rowform.$visible" class="btn btn-primary btn-sm" ng-click="rowform.$show()"><b class="glyphicon glyphicon-edit"></b></button>
                <button ng-show="!rowform.$visible" class="btn btn-danger btn-sm" ng-click="removeRow($index)"><b class="glyphicon glyphicon-trash"></b></button>
            </td>
        </tr>
        <tr class="hidden-print">
            <td><span class="form-control-static">{{newRow.name}}</span></td>
            <td>
                <input form="newRowForm" name="modelNumber" ng-model="newRow.modelNumber" type="text" class="form-control" required typeahead-template-url="customTemplate.html"
                       typeahead-editable="false" typeahead-on-select="updateQuoteItem($item, newRow)" typeahead="equipment as equipment.modelNumber for equipment in getEquipmentList($viewValue)" />
            </td>
            <td><span class="form-control-static">{{newRow.manufacturer}}</span></td>
            <td>
                <select form="newRowForm" name="servicePlace" ng-options="s.value as s.text for s in servicePlaces" class="editable-input form-control ng-pristine ng-valid" ng-model="newRow.servicePlace" required>
                    {{showServicePlaces(newRow.servicePlace)}}
                </select>
            </td>
            <td><input form="newRowForm" name="quantity" ng-model="newRow.quantity" min="1" type="number" class="form-control text-center" required /></td>
            <td><input form="newRowForm" name="unitPrice" ng-model="newRow.unitPrice" min="0" type="number" class="form-control text-right" required /></td>
            <td><span class="form-control-static text-right">{{(newRow.unitPrice * newRow.quantity) | number}}</span></td>
            <td class="text-right">
                <form name="newRowForm" id="newRowForm" novalidate>
                    <input form="newRowForm" name="poNumber" ng-model="newRow.modelNumber" hidden type="text" class="form-control" required />
                    <input form="newRowForm" name="quantity" ng-model="newRow.quantity" type="number" min="1" hidden class="form-control" required />
                    <input form="newRowForm" name="unitPrice" ng-model="newRow.unitPrice" type="number" min="0" hidden class="form-control" required />
                    <button class="btn btn-primary btn-sm" ng-click="addRow(newRow)" ng-disabled="newRowForm.$invalid"><b class="glyphicon glyphicon-plus"></b></button>
                </form>
            </td>
        </tr>
        <tr>
            <td colspan="6" class="text-right"><strong class="form-control-static">Transportation/Shipping/Delivery/Onsite Service Charges</strong></td>
            <td>
                <a href="#" editable-number="model.serviceCharges" e-min="0" e-step="100" buttons="no" blur="submit" class="text-right" e-class="text-right">
                    {{model.serviceCharges | number}}
                </a>
            </td>
            <td class="hidden-print"></td>
        </tr>
        <tr>
            <td colspan="4" class="text-right"><strong class="form-control-static">Total units</strong></td>
            <td class="text-center">
                <span class="form-control-static">{{totalAmount | number}}</span>
            </td>
            <td class="text-right"><strong class="form-control-static">SubTotal</strong></td>
            <td class="text-right">
                <span class="form-control-static">{{totalPrice | number}}</span>
            </td>
            <td class="hidden-print"></td>
        </tr>
        <tr>
            <td colspan="6" class="text-right"><strong class="form-control-static">Tax</strong></td>
            <td>
                <a href="#" editable-number="model.tax" e-min="0" e-step="1" buttons="no" blur="submit" class="text-right" e-class="text-right">
                    {{model.tax | number}}%
                </a>
            </td>
            <td class="hidden-print"></td>
        </tr>
        <!--<tr>
            <td colspan="4" class="text-right"><strong class="form-control-static"></strong></td>
            <td class="text-center">
                <a href="#" editable-number="model.tax" e-min="0" e-step="1" buttons="no" blur="submit" class="text-right" e-class="text-right">
                    {{model.vat | number}}%
                </a>
            </td>
            <td class="text-right"><strong class="form-control-static">VAT</strong></td>
            <td class="text-right">
                <span class="form-control-static">{{totalVat | number}}</span>
            </td>
            <td class="hidden-print"></td>
        </tr>-->
        <tr>
            <td colspan="6" class="text-right"><strong class="form-control-static grand-total">Total(VND)</strong></td>
            <td class="text-right">
                <strong class="form-control-static">{{grandTotal | number}}</strong>
            </td>
            <td class="hidden-print"></td>
        </tr>
        <tr>
            <td colspan="4" class="text-right"><strong class="form-control-static">Exchange rate USD</strong></td>
            <td class="text-center">
                <a class="exchange-rate" href="#" editable-number="model.exchangeRate" e-min="0" e-step="10" buttons="no" blur="submit">{{model.exchangeRate | number}}</a>
            </td>
            <td class="text-right"><strong class="form-control-static grand-total">Total(USD)</strong></td>
            <td class="text-right">
                <strong class="form-control-static">{{grandTotal2 | number}}</strong>
            </td>
            <td class="hidden-print"></td>
        </tr>
    </tbody>
</table>

<div ng-if="pageCount > 1" style="page-break-before: always; height: 60px;"></div>


<div class="visible-print" style="font-size: 9px;">
    <p><strong><u>Calibration Schedule:</u></strong></p>
    <p>* Starting Calibration service within 7 days after receiving <strong>PO</strong> or <strong>Confirm Order</strong> * Complete calibration in within 7 day(s) onsite/KL Lab</p>
    <p class="text-center spacing-top-md"><strong>Approved Quotation</strong></p>
    <div class="row">
        <div class="col-xs-4 text-center">
            <div><strong>Sales person</strong></div>
        </div>
        <div class="col-xs-4 text-center">
            <div><strong>Sales manager</strong></div>
        </div>
        <div class="col-xs-4 text-center">
            <img src="../../../Content/images/sign.png" style="width: 70%;" />
        </div>
    </div>
    <p><strong><u>Note of Payment:</u></strong></p>
    <ul>
        <li>Total Price quote is NOT including VAT Tax</li>
        <li>Quote valid for 30 days</li>
        <li>Registered Invoice will be sent to customer after complete calibration service</li>
        <li> Payment term: Net 7 days by Cash or Bank Transfer after receiving Register Invoice</li>
    </ul>
    <p><strong><u>Calibration Note:</u></strong></p>
    <ol>
        <li><strong>Price quote above is for Calibration only!</strong></li>
        <li><strong>For "Rejected" and "Bad/Not functioning" equipment:</strong></li>
        <ul style="list-style-type:none;">
            <li>2.1    If equipment is "Rejected" but still need to issue Certificate, Kim Long will charges 30% of Calibration Price.</li>
            <li>2.2    Free of charge if Kim Long technician can adjust equipment back to its "Tolerance".</li>
        </ul>
        <li>
            <strong>LIMITATION OF LIABILITY:</strong>
            <ul style="list-style-type:none;">
                <li>3.1   Kim Long liability here-under shall be limited to the repair, restoration, or replacement of equipment items to the condition in which they were received by Kim Long upon pickup and/or serviced at the Customers facility.</li>
                <li>3.2    In no event shall Kim Long be liable for any special, indirect, incidental, consequential or liquidated, penal or any economic loss damages of any character, including, but not limited to loss of the customer's property lost profits or lost production, whether claimed by the customer or by a third party, irrespective of whether claims or actions for such damages are based upon agreement, warranty, negligence, strict liability or otherwise.</li>
            </ul>
        </li>
    </ol>

    <table class="table table-bordered table-padding">
        <tr><td class="text-center" colspan="2"><strong>CUSTOMER CONFIRMATION</strong></td></tr>
        <tr>
            <td style="width: 60%;"><div style="height: 12px; width: 12px; border: 1px solid #777; display: inline-block; margin: 0px 6px 0px 4px;">&nbsp;</div>Agree with the content above</td>
            <td rowspan="4"></td>
        </tr>
        <tr><td><div style="height: 12px; width: 12px; border: 1px solid #777; display: inline-block; margin: 0px 6px 0px 4px;">&nbsp;</div>Agree with the proposed changes as follows</td></tr>
        <tr><td>Full Name:</td></tr>
        <tr><td>Title:</td></tr>
        <tr><td>Phone:</td><td class="text-center">(Signature & Seal)</td></tr>
    </table>
</div>

<page-footer page="pageCount" standard="KQ-230.1 - Form Date: Jan/2014">
</page-footer>

<nav class="navbar navbar-default navbar-fixed-bottom navbar-inverse" role="navigation">
    <div class="container">
        <button class="btn btn-info navbar-btn" ng-click="back()">Back</button>
        <button class="btn btn-warning navbar-btn" has-access="Admin" busy-click="remove(model)" success="Deleted successfully" ng-show="model.id != undefined">Delete</button>
        <button class="btn btn-info navbar-btn" ng-show="model.id != undefined" ng-click="copy()">Copy</button>
        <button class="btn btn-info navbar-btn" ng-show="model.id != undefined" busy-click="update(model)" success="Updated successfully">Update</button>
        <button class="btn btn-info navbar-btn" ng-hide="model.id != undefined" busy-click="save(model)" success="Created successfully">Save</button>
        <button class="btn btn-info navbar-btn" ng-show="model.id != undefined" ng-click="doPrint()"><i class="glyphicon glyphicon-print"></i>&nbsp;Print</button>
    </div>
</nav>
